﻿using UnityEngine;
using UnityEngine.UI;

class PlayerHeadPanel : PanelBase
{
    [SerializeField]
    private Image hpImg;
    [SerializeField]
    private Text hpText;
    public override void RegisterListeners()
    {
        base.RegisterListeners();
        Mgr.fightMgr.fightEvent.AddListener(FightEvent.PlayerChangeHp, PlayerChangeHpHandler);
    }

    private void PlayerChangeHpHandler(object data)
    {
        int[] hpArr = data as int[];
        hpImg.fillAmount = (float)hpArr[0] / hpArr[1];
        hpText.text = hpArr[0] +"/"+ hpArr[1];
    }
}
